package com.woniuxy.mesboot.controller;

import com.woniuxy.mesboot.service.ProductInspectionService;
import com.woniuxy.mesboot.service.WorkOrderService;
import com.woniuxy.mesboot.service.WorkReportingService;
import com.woniuxy.mesboot.util.Result;
import com.woniuxy.mesboot.vo.ProductInspectionVO;
import com.woniuxy.mesboot.vo.WorkReportingVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：lisir
 * @date ：Created in 2023/5/31 9:59
 * @description：生产看板数据获取
 */
@RestController
@RequestMapping("/data")
public class DataController {

    @Resource
    private WorkOrderService workOrderService;

    @Resource
    private WorkReportingService workReportingService;

    @Resource
    private ProductInspectionService productInspectionService;

    @GetMapping
    public Result queryAll() {
        List<WorkReportingVO> workReportingVOS = workReportingService.selectByTime();
        Integer product = workOrderService.selectByTimeCount();
        Integer finish = workOrderService.selectFinish();
        List<ProductInspectionVO> productInspectionVOS = productInspectionService.selectByProduct();
        return Result.ok()
                .data("workReporting",workReportingVOS)
                .data("productionWork", product)
                .data("finishWork", finish)
                .data("productInspection",productInspectionVOS);
    }
}
